Repository navigation
Conversation
Signed-off-by: Vigilans <vigilans@foxmail.com>
| for (const rootFolder of workspace.workspaceFolders) { | ||
| workspace.workspaceFolders.forEach(rootFolder => { | ||
| if (rootFolder.uri.scheme !== 'file') { | ||
| continue; |
There was a problem hiding this comment.
why? if subsequent folders have the file:// prefix, why should they be discarded?
There was a problem hiding this comment.
mmm so here return simply returns from the lambda, so it's fine
There was a problem hiding this comment.
I change the for...of pattern to forEach, and here return is equivalent to continue, just to continue the outer loop...
|
I can still see the bug when no java files have been opened and some commands triggered the activation of vscode-java. |
|
@fbricon Searching for java file needs |
|
it's not a requirement per se, but I'd be fine performing the lookup asynchronously in a different method |
Signed-off-by: Vigilans <vigilans@foxmail.com>
|
I've add java file searching in workspace as the last resort. It searches all src folder in the workspace, whenever one java file is found, it will stop searching. |
| } | ||
| }); | ||
|
|
||
| for (const javaFile of await workspace.findFiles("**/src/**/*.java", undefined, 1)) { // Find at most 1 java file |
There was a problem hiding this comment.
I'd rather be more conservative and look for src/**/*.java instead, or else if we might have some performance issues in case a very large folder has been opened
There was a problem hiding this comment.
I've changed to src/**/*.java now. Is trigger file only used for invisible project? If so, then indeed we can assume that src will cover most cases, since multi-module project will use a build tool instead.
But we may also search java files under the workspace root directory, since the user of invisible project may only create java files in the outermost place.
There was a problem hiding this comment.
I've changed to src/**/*.java now. Is trigger file only used for invisible project? If so, then indeed we can assume that src will cover most cases, since multi-module project will use a build tool instead.
yes src/**/*.java is only for invisible projects.
But we may also search java files under the workspace root directory, since the user of invisible project may only create java files in the outermost place.
yes makes sense
Signed-off-by: Vigilans <vigilans@foxmail.com>
Signed-off-by: Vigilans <vigilans@foxmail.com>
|
Now trigger file of one specific workspace folder is being searched as following order:
and will early exit whenever one java file is found. |
|
what are workspace.textDocuments? |
|
@fbricon Whenever So using |
|
in which circumstance could we have a Java file present in in textDocuments but not in the list of visible text editors, that would need to trigger the language server? |
|
It is the first situation that this PR tries to resolve: #1198 When opening a java file to activate the extension, the In this circumstance:
|
|
Thanks @Vigilans! |
Fix #1198
Trigger file will now try to get documents from all opened text documents, if all trials from previous version failed.